layui.define(['carousel','jquery','element','flow','laytpl','element','laypage','form','util'],function(exports){
  var carousel = layui.carousel,$ = layui.$,flow = layui.flow,laytpl = layui.laytpl,element = layui.element,laypage = layui.laypage,form = layui.form,
  util = layui.util;
  var index = {
    // 移动端下面导航按钮
    common:function(){
      var off = true;
      $('.menu-icon').on('click',function(){
        if(off){
          $('.mobile-nav').addClass('layui-show')
        }else{
          $('.mobile-nav').removeClass('layui-show')
        }
        off = !off
      })
    },  
    //超出多少文字就省略号
    omitted: function(ele,num){
      $(ele).each(function() {
          var str = $(this).html();
          var subStr = str.substring(0, num);
          $(this).html(subStr + (str.length > num ? '...' : ''));
      });
    },

    //搜索跳转的页面
    seachBtn: function(){
      $('.search-btn').on('click',function(){
        var inpVal = $(this).siblings('input').val();
        if(inpVal){
          window.location.href="/search?keyword="+inpVal+"&page=1"
        }; 
        return false;
      })
    }

    // 右侧小箭头
    ,arrowutil: function(){
      //固定 bar
      util.fixbar({
        click: function(type){
          if(type === 'bar1'){
            //
          }
        }
      });
    }

  }

  index.common()
  exports('index',index)
});